/*
 * @features: 主要功能
 * @description: 内容说明
 * @Date: 2021-10-09 12:42:45
 * @Author: judu233(769471424@qq.com)
 * @LastEditTime: 2021-10-09 12:42:45
 * @LastEditors: judu233
 */

class SkeletonExtends {

    /**
     * @description 扩展方法
     * @param remotePath 远程资源路径
     * @param name 远程Spine文件名，不再后缀
     * @param completeCallback 完成回调
     * @param isNeedCache 是否需要缓存到本地,如果不需要，每次都会从网络拉取资源,默认都会缓存到本地
     * @param config.retain 远程加载的资源是否驻留在内存中,默认都不驻留内存
     * @example
     * var skeleton = node.addComponent(sp.Skeleton);
     *
     * let path = "https://bc-test1.oss-cn-shenzhen.aliyuncs.com/image/action";
     * let name = "nnoh_v4";
     * skeleton.loadRemoteSkeleton({view : this , path : path, name : name, completeCallback : (data:sp.SkeletonData)=>{
     *    if (data) {
     *        skeleton.animation = 'loop';
     *        skeleton.premultipliedAlpha = false;
     *    }
     * }});
     */
    loadRemoteSkeleton(config: any) {
        let me = this;
        // if (config.isNeedCache == undefined || config.isNeedCache == null) {
        //     config.isNeedCache = true;
        // }
        // Manager.assetManager.remote.loadSkeleton(config.path, config.name, config.isNeedCache).then((data) => {
        //     setSkeletonSkeletonData(me, config, data as sp.SkeletonData, Resource.Type.Remote);
        // });
    }

    /**
     * @description 加载动画
     * @example
     * action.loadSkeleton({url:"hall/vip/vipAction/vip_10",view:this,completeCallback:(data)=>{
     *	if ( data ){
     *		action.animation = "loop";
     *		action.loop = true;
     *		action.premultipliedAlpha = false;
     *	}
     * }});
     */
    loadSkeleton(config: any) {
        let me = this;
        // let url = config.url;
        // let bundle = getBundle(config);
        // Manager.cacheManager.getCacheByAsync(url, sp.SkeletonData, bundle).then((data) => {
        //     setSkeletonSkeletonData(me, config, data);
        // });
    }
}